package com.lavegue.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;

import com.lavegue.common.BaseService;
import com.lavegue.common.Page;
import com.lavegue.dao.SysMessageDao;
import com.lavegue.model.SysMsg;
import com.lavegue.service.SysMessageService;



/**
 * author: tianzhifen
 * date:2011-12-21
 * description:
 *
 */
public class SysMessageServiceImpl extends BaseService<SysMsg, Integer, SysMessageDao> implements SysMessageService {
	private SysMessageDao sysMsgDao;
	
	public SysMessageDao getSysMsgDao() {
		return sysMsgDao;
	}

	public void setSysMsgDao(SysMessageDao sysMsgDao) {
		this.sysMsgDao = sysMsgDao;
	}

	
	/**
	 * ljp 20120112 查询所有发件人的消息
	 * 
	 * @param pageNo 当前页数
	 * @param pageSize 每页多少条
	 * @param userId 用户ID(接收者的ID)
	 * @return sysmsg对象
	 * @throws Exception
	 */
	public Page<SysMsg> queryAllSysMsgList(int pageNo, int pageSize,int userId){
		
		return sysMsgDao.queryAllSysMsgList(pageNo, pageSize,userId);
	}
	
	/**
	 * ljp 20120112  通过ID删除系统消息记录
	 * @param sysMsgId 系统消息ID
	 * @throws Exception
	 */
	public boolean deleteSysMsgById(SysMsg entity){
		boolean flag = false;
		try {
			flag = sysMsgDao.deleteSysMsgById(entity);
			return flag;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return flag;
	}
	
	/**
	 * ljp 20120112  通过ID查询系统消息记录
	 * @param sysMsgId 系统消息ID
	 * @throws Exception
	 */
	public SysMsg querySysMsgById(Integer sysMsgId){
		return sysMsgDao.querySysMsgById(sysMsgId);
	}
	
}

